<?php defined('IN_HOPECMS') or exit('Access Denied'); ?>
<script type="text/javascript" src="{__PUBLIC__}script/tab.js"></script>
<script type="text/javascript" src="{__PUBLIC__}ue/editor_config.js"></script>
<script type="text/javascript" src="{__PUBLIC__}ue/editor_all_min.js"></script>
<script type="text/javascript">
$(function(){
	$('#tab .tab-title li').tab({
		content : '#tab .tab-content',
		style   : 'active'
	});
});
</script>
<form name="add_category" method="post">
	<div class="content-title"><?php if (!isset($stauts)) :?>添加栏目<?php else : ?>修改栏目 - <?php echo $cat['name']; endif; ?></div>
	<div id="tab">
		<div class="tab-title">
			<ul>
				<li class="li active">基本信息</li>
				<li class="li">模板设置</li>
				<li class="li">SEO优化</li>
				<li class="li">权限设置</li>
			</ul>
		</div>
		<div class="clear"></div>
		<div class="tab-content">
			<table class="table-input" cellpadding="0" border="0" cellspacing="0" width="100%">
				<tr>
					<td class="td-title">所属模型：</td>
					<td class="td-value">
						<?php echo $model_data; ?>
					</td>
					<td class="td-mark"><span class="col-red">*</span> 栏目所属的数据模型</td>
				</tr>
				<tr>
					<td class="td-title">上级栏目：</td>
					<td class="td-value" id="ad">
						<?php echo $tree_data;?>
					</td>
					<td class="td-mark">不选择为顶级栏目</td>
				</tr>
				<tr>
					<td class="td-title">栏目名称：</td>
					<td class="td-value"><input type="text" v="re" msg="请输入栏目名称" value="<?php if (isset($cat['name'])): echo $cat['name']; endif;?>" name="name" /></td>
					<td class="td-mark"><span class="col-red">*</span> 请输入栏目名称</td>
				</tr>
				<tr>
					<td class="td-title">英文名称：</td>
					<td class="td-value"><input type="text" value="<?php if (isset($cat['enname'])): echo $cat['enname']; endif;?>" name="enname" /></td>
					<td class="td-mark">一般用于代替ID来优化url，使url更加简介和友好。必须开启伪静态和路由才有效</td>
				</tr>
				<tr>
					<td class="td-title" id="bd_edit">栏目图片：</td>
					<td class="td-value" id="setimg"></td>
					<td class="td-mark"><?php echo Html::uploadOneImg('setimg', 'bd_edit',  isset($cat['image']) ? $cat['image'] : '');?></td>
				</tr>
				<tr>
					<td class="td-title">是否显示：</td>
					<td class="td-value"><input name="is_show" type="radio" value="1" <?php echo (isset($cat['is_show']) && $cat['is_show'] == 1) ? 'checked="checked"' : !isset($cat['id_show']) ? 'checked="checked"' : ''; ?> />是
						<input name="is_show" type="radio" value="0" <?php echo (isset($cat['is_show']) && $cat['is_show'] == 0) ? 'checked="checked"' : ''; ?> />否
					</td>
					<td class="td-mark"></td>
				</tr>
			</table>
		</div>
		<div class="tab-content">
			<table class="table-input" cellpadding="0" border="0" cellspacing="0" width="100%">
				<tr>
					<td class="td-title" width="150">频道页模板：</td>
					<td class="td-value">
						<input type="text" v="re" msg="请输入频道页模板" value="<?php if (isset($cat['category_tpl'])): echo $cat['category_tpl']; else: echo 'category.php'; endif;?>" name="category_tpl" />
					</td>
					<td class="td-mark"></td>
				</tr>
				<tr>
					<td class="td-title" width="150">列表页模板：</td>
					<td class="td-value">
						<input type="text" v="re" msg="请输入列表页模板" value="<?php if (isset($cat['list_tpl'])): echo $cat['list_tpl']; else: echo 'list.php'; endif;?>" name="list_tpl" />
					</td>
					<td class="td-mark"></td>
				</tr>
				<tr>
					<td class="td-title" width="150">内容页模板：</td>
					<td class="td-value">
						<input type="text" v="re" msg="请输入内容页模板" value="<?php if (isset($cat['show_tpl'])): echo $cat['show_tpl']; else: echo 'show.php'; endif;?>" name="show_tpl" />
					</td>
					<td class="td-mark"></td>
				</tr>
			</table>
		</div>
		<div class="tab-content">
			<table class="table-input" cellpadding="0" border="0" cellspacing="0" width="100%">
				<tr>
					<td class="td-title" width="150">Mete Title：</td>
					<td class="td-value"><input type="text" value="<?php if (isset($cat['seo_title'])): echo $cat['seo_title']; endif;?>" name="seo_title" /></td>
					<td class="td-mark">针对搜索引擎设置的标题</td>
				</tr>
				<tr>
					<td class="td-title" width="150">Mete Keywords：</td>
					<td class="td-value">
						<input type="text" value="<?php if (isset($cat['seo_keywords'])): echo $cat['seo_keywords']; endif;?>" name="seo_keywords" />
					</td>
					<td class="td-mark">关键字中间用半角逗号隔开</td>
				</tr>
				<tr>
					<td class="td-title" width="150">Mete Description：</td>
					<td class="td-value"><input type="text" value="<?php if (isset($cat['seo_description'])): echo $cat['seo_description']; endif;?>" name="seo_description" /></td>
					<td class="td-mark">针对搜索引擎设置的网页描述</td>
				</tr>
			</table>
		</div>
		<div class="tab-content">
			<table class="table-input" cellpadding="0" border="0" cellspacing="0" width="100%">
				<tr>
					<td class="td-title td-ct" width="15">全选</td>
					<td class="td-title td-ct">角色名</td>
					<td class="td-title td-ct">查看</td>
					<td class="td-title td-ct">添加</td>
					<td class="td-title td-ct">修改</td>
					<td class="td-title td-ct">删除</td>
					<td class="td-title td-ct">排序</td>
					<td class="td-title td-ct">移动</td>
				</tr>
				<?php
					foreach ($roles as $role) :
				?>
				<tr>
					<td class="td-title" style="height:25px;"><?php if ($role['rid'] != 1) :?><input type="checkbox" onclick="select_all(this, 'select_checkbox')" /><?php endif; ?></td>
					<td class="td-title" style="height:25px;"><?php echo $role['role_name'];?></td>
					<?php for($i = 0; $i < 6; $i++):?>
					<td class="td-title select_checkbox" style="height:35px;">
						<input type="checkbox" <?php if ($role['rid'] == 1): echo 'checked="checked" disabled="disabled" value="1"'; elseif(!empty($cat['role_'.$role['rid']][$i])): echo 'value="1" checked="checked"'; else: echo 'value="0"'; endif; ?> name="role_<?php echo $role['rid'];?>[]" />
					</td>
					<?php endfor; ?>
				</tr>
				<?php endforeach;?>
			</table>
		</div>
	</div>
	<?php if (isset($stauts)) :?>
	<input type="hidden" name="cat_id" value="<?php echo $cat['cat_id'];?>" />
	<input type="hidden" name="type" value="0" />
	<?php endif;?>
	<input type="hidden" name="token" value="<?php echo $token_code;?>" />
</form>